package com.shop.controllers;

import java.util.List;

import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.ResponseBody;
import org.springframework.web.servlet.ModelAndView;

import com.google.gson.Gson;

@Controller
public class indexController {
	@ResponseBody
    @RequestMapping(value ="html/index", produces = "application/json;charset=utf-8",method ={RequestMethod.GET})
	public String hello(String type){  
		if(type.equals("new_goods")) {
		String[] back= {
				"111adidas nike lining","222adidas nike lining",
				"333adidas nike lining","444adidas nike lining"
		};

        Gson gson =new Gson();
        String json =gson.toJson(back);
		return json;
		}
		else if(type.equals("best_goods")) {
			String[] back= {
					"111best goods","222best goods",
					"333best goods","444best goods"
			};

	        Gson gson =new Gson();
	        String json =gson.toJson(back);
			return json;
		}
		else return "false";
		
    }
	
	  @RequestMapping(value ="html/hello2", produces = "application/json;charset=utf-8",method ={RequestMethod.GET})
		public String hello2(String age){  
			
			String[] back= {
					"111adidas nike lining","222adidas nike lining",
					"333adidas nike lining","444adidas nike lining"
			};

	        Gson gson =new Gson();
	        String json =gson.toJson(back);
			return json;
	    }
   
}

